#!/bin/bash

# 指定要关闭的端口
PORT=9900

# 查找占用指定端口的进程ID
PID=$(lsof -t -i:$PORT)

# 检查是否找到进程ID
if [ -z "$PID" ]; then
  echo "Port $PORT is not in use."
else
  # 杀死占用端口的进程
  kill -9 $PID
  echo "Process $PID that was using port $PORT has been terminated."
fi

# 赋予脚本的执行权限
#chmod +x close_port.sh

# 执行脚本
#./close_port.sh
